package top.techqi.view.recyclerview.tile

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.viewbinding.ViewBinding

private typealias HolderBindingFactory<T> = (LayoutInflater, ViewGroup?, Boolean) -> T

abstract class BindHolder<R : TileRecord, VB : ViewBinding> private constructor(
    inflater: LayoutInflater, container: ViewGroup, val binding: VB
) : TileHolder<R>(binding.root) {
    constructor(
        inflater: LayoutInflater,
        container: ViewGroup,
        bindingFactory: HolderBindingFactory<VB>
    ) : this(inflater, container, bindingFactory(inflater, container, false))
}